package gat.common.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * @Author
 * @Date 2022/5/10
 * @Version 1.0
 */
@NoArgsConstructor
@AllArgsConstructor
@Getter
public enum FriendRequestStatusEnums {

    pending_review(1, "待审核"),
    rejected(0, "已拒绝"),
    pass(2, "好友通过");

    private Integer code;

    private String value;

    @JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
    public static FriendRequestStatusEnums getByCode(@JsonProperty("code") String code) {
        for (FriendRequestStatusEnums value : values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }

}
